package com.example.jpademo3.model;
//import javax.persistencestence.*;//for Spring Boot 2

import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Setter
@Getter
@NoArgsConstructor
@Entity //注释表示该类为持久化Java类。
@Table(name = "tutorials")//@Table注释提供映射这个实体的表。
public class Tutorial {

    @Id //@Id注释用于主键。
    //注释用于定义主键的生成策略。GenerationType。AUTO表示自动增量字段
    @GeneratedValue(strategy = GenerationType.AUTO)
    private long id;

    //用于定义数据库中对应带注释字段的列。
    @Column(name = "title")
    private String title;

    @Column(name = "description")
    private String description;

    @Column(name = "published")
    private boolean published;

    public Tutorial(String title, String description, boolean published) {
        this.title = title;
        this.description = description;
        this.published = published;
    }


}